Object.defineProperty(exports, "__esModule", { value: !0 }),
  (exports.genThirdUserId = function (e) {
    return a.apply(this, arguments);
  }),
  (exports.getUserId = function () {
    e || (e = (0, n.getStorage)("userId"));
    return e;
  }),
  (exports.setUserId = u);
var e,
  r = require("../../@babel/runtime/helpers/regeneratorRuntime"),
  t = require("../../@babel/runtime/helpers/asyncToGenerator"),
  n = require("../utils/storage"),
  s = require("../api/C2API");
function u(r) {
  r && e !== r && ((e = r), (0, n.setStorage)("userId", r));
}
function a() {
  return (a = t(
    r().mark(function e(t) {
      var a, i, o, c;
      return r().wrap(function (e) {
        for (;;)
          switch ((e.prev = e.next)) {
            case 0:
              return (
                (a = Date.now()),
                (i = t + "_" + a.toString(36)),
                (e.next = 4),
                s.C2API.thirdAuth({ thirdUserId: i, n: 1 })
              );
            case 4:
              (o = e.sent),
                (c = o.data),
                0 === o.code &&
                  (u(c.userId), (0, n.setStorage)("isStorageUser", "1"));
            case 8:
            case "end":
              return e.stop();
          }
      }, e);
    }),
  )).apply(this, arguments);
}
